* {
  margin: 0;
  padding: 0;
}
body {
  height: 100vh;
  background: linear-gradient(#99f, #f99);
}
body,
.navbar,
.navbar ul {
  display: flex;
  justify-content: center;
  align-items: center;
}
.navbar {
  position: relative;
  padding: 20px;
  border-radius: 50px;
  background-color: #fff;
}
.navbar input {
  width: 40px;
  height: 40px;
}
.navbar span {
  position: absolute;
  left: 25%;
  top: calc(50% - 10px);
  width: 40px;
  height: 4px;
  border-radius: 15px;
  background-color: #999;
  pointer-events: none;
  transition: transform 0.4s ease-in-out 0.4s, left 0.4s ease-in-out, top 0.4s ease-in-out;
}
.navbar span:nth-of-type(2) {
  top: calc(50% + 6px);
}
.navbar ul {
  width: 0px;
  overflow: hidden;
  white-space: nowrap;
  transition: transform 0.4s ease-in-out 0.4s, width 0.4s ease-in-out;
}
.navbar ul li {
  list-style: none;
  margin: 0 15px;
}
.navbar ul li a {
  text-decoration: none;
  font-size: 20px;
  font-weight: 700;
  color: #333;
}
.navbar ul li a:hover {
  color: #fb7299;
}
.navbar input {
  width: 40px;
  height: 40px;
  opacity: 0;
  cursor: pointer;
}
.navbar input:checked ~ ul {
  width: 350px;
  transition: width 0.4s ease-in-out, transform 0.4s ease-in-out 0.4s;
}
.navbar input:checked ~ span {
  left: 5%;
  transition: top 0.4s ease-in-out, left 0.4s ease-in-out, transform 0.4s ease-in-out 0.4s;
}
.navbar input:checked ~ span:nth-of-type(2) {
  top: calc(50% - 2px);
  transform: rotate(-45deg);
  background-color: #fb7299;
}
.navbar input:checked ~ span:nth-of-type(1) {
  top: calc(50% - 2px);
  transform: rotate(45deg);
  background-color: #fb7299;
  transition: top 0.4s ease-in-out, left 0.4s ease-in-out, transform 0.4s ease-in-out 0.4s;
}
